import Taro, { Component } from '@tarojs/taro'
import { View, Text, Navigator } from '@tarojs/components'
// import NongBankIcon from '../../images/bank/2.png'  这个

import './ProductItem.scss'

export default class ProductItem extends Component {

  render () {
     let {url,src,name,productType,rate,rateType,time} = this.props //获取父组件传递过来的对象（url、title、time）
     let {openType} = this.props //获取父组件传递过来的对象 非必须
    return (
    <Navigator openType={openType?openType:'switchTab'} className='product_item' url={url}> 
      <View className='product_image'>
        {/* 注意！图片路径的引用不是以下这样写的 */}
        {/* <Image src='../../images/bank/2.png'></Image> */}
        <Image mode='widthFix' src={src}></Image>
      </View>
      <View className='product_info'>
        <View className='product_name_info'>
          <View className='product_name'>{name}</View>
          <View className='product_type'>{productType}</View>
        </View>
        <View className='product_rate_info'>{rate}</View>
        <View className='product_time_info'>
          <View className='product_time'>{time}</View>
          <View className='product_rate_type'>{rateType}</View>
        </View>
      </View>
    </Navigator>
    )
  }
}
